package com.caiyi.financial.nirvana.sms.util;

import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MD5Util {

    private MD5Util() {
    }

    private static Logger logger = LoggerFactory.getLogger(MD5Util.class);

    public static String encode(String encodeText) {
        String text = "";
        try {
            text = DigestUtils.md5Hex(encodeText).toUpperCase();
        } catch (Exception e) {
            logger.error("MD5Util encode error ", e);
        }
        return text;
    }

    public static byte[] Md5Byte(String encodeText) {
        byte[] text = null;
        try {
            text = DigestUtils.md5(encodeText);
        } catch (Exception e) {
            logger.error("MD5Util encode error ", e);
        }
        return text;
    }

}
